package com.websocket.Controller;

import com.websocket.entity.WiselyMessage;
import com.websocket.entity.WiselyResponse;
import org.springframework.messaging.handler.annotation.MessageMapping;
import org.springframework.messaging.handler.annotation.SendTo;
import org.springframework.stereotype.Controller;

import javax.websocket.OnOpen;

/**
 * Created by WCJ on 2018/1/12.
 * 方法一
 */
@Controller
public class MessageController {
    private static int onlineNum = 0;

    @MessageMapping("/welcome")
    @SendTo("/topic/getResponse")
    public WiselyResponse say(WiselyMessage message) throws Exception {
        return new WiselyResponse(message.getName() + "!");
    }
}
